package com.shaozi.nc.quartz;

import java.util.List;
import java.util.concurrent.CountDownLatch;

import com.shaozi.lib.execpool.TaskRunnable;
import com.shaozi.lib.execpool.base.ExecutorDataBean;
import com.shaozi.nc.data.model.PushMsgModel;
import com.shaozi.nc.manage.PushMsgManage;
import com.shaozi.utils.common.BeanUtils;

public class PushJobRunnable implements TaskRunnable {
	private static final int Once_Limit = 100;

	public PushJobRunnable() {

	}

	@Override
	public void run(ExecutorDataBean bean) {
		CountDownLatch latch = (CountDownLatch) bean.datas.get("countDownLatch");
		try {
			doJob(bean);
		} finally {
			latch.countDown();
		}
	}

	protected void doJob(ExecutorDataBean bean) {
		String compId = (String) bean.datas.get("compId");
		PushMsgManage pushMsgMgr = (PushMsgManage) BeanUtils.getBean("pushMsgMgr");
		List<PushMsgModel> models = pushMsgMgr.getRunnableJob(compId, Once_Limit);
		if (models.isEmpty())
			return;
		for (PushMsgModel model : models) {
//			model.get
		}
	}

}
